#ifndef __SERVER_OBJECT_MANAGER__
#define __SERVER_OBJECT_MANAGER__


#include <list>
#include <windows.h>
#include <cassert>

#include "..\Common\CommonObject.h"


class object_manager {
public:
	struct object_info {
		unsigned int	ObjectID;
		OBJECT_TYPE		ObjectType;		
		unsigned int	ObjectOwnerCode;
		int				ObjectExtraLength;
		char*			ObjectExtraData;		
	};

	typedef std::list<object_info>	object_info_list;	

private:
	object_info_list			m_ObjectInfoList;
	object_info_list::iterator	m_Repeator;

	CRITICAL_SECTION	m_CriticalSection;
	bool				m_bRepeating;

	unsigned int GenerateObjectID(void);

public:
	object_manager(void);
	~object_manager(void);

	// repeat methods.
	void			StartRepeat(void);
	void			EndRepeat(void);
	void			NextRepeat(void);
	object_info*	Repeat(void);

	int GetObjectCount(void);
	unsigned int NewObject(OBJECT_TYPE ObjectType, unsigned int OwnerCode, int ExtraLength, char* ObjectExtraData);
	bool DeleteObject(unsigned int ObjectID);	
};

#endif